cmake_minimum_required(VERSION 3.10)

project(hello)

set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})
set(CMAKE_INSTALL_DIR dist)

# C++
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Boost
find_package(Boost 1.46.1 REQUIRED COMPONENTS filesystem)

if (Boost_FOUND)
    message("boost found")
else()
    message(FATAL_ERROR "cannot find boost")
endif()

# Qt
set(CMAKE_AUTOUCC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

find_package(Qt5 COMPONENTS Widgets REQUIRED)

add_subdirectory(HelloWorld)

add_executable(${PROJECT_NAME} 
    src/main.cpp
    src/widget.cpp
    src/widget.h
)

target_link_libraries(${PROJECT_NAME}
    PRIVATE
        HelloWorld
        Boost::filesystem
        Qt5::Widgets
)

set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "@executable_path/")

install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_DIR})

install(FILES README.md DESTINATION ${CMAKE_INSTALL_DIR})
